package com.codelife.one.Clone;

/**
 * @ClassName Test
 * @Description TODO
 * @Date 2019/10/22 15:42
 * @Version 1.0
 **/
public class Test {

    public static void main(String[] args) {
        Stuend stuend = new Stuend();
        stuend.setName("1111");
        stuend.setAge(1);

        Demo1 demo1 = new Demo1();
        demo1.setName("2222");
        demo1.setStuend(stuend);
        Demo1 demo2=null;

        try {
            demo2 =(Demo1)demo1.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        System.out.println(demo1);
        demo2.getStuend().setName("3333");
        demo2.getStuend().setAge(3);

        System.out.println(demo1);
        System.out.println(demo2);
    }
}
